<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		    <meta name="apple-mobile-web-app-capable" content="yes">
		    <meta name="apple-mobile-web-app-status-bar-style" content="black">
		    <meta name="format-detection" content="telephone=no">
		    <meta name="description" content="">
		    <meta http-equiv="x-dns-prefetch-control" content="on">
		<title>我的公会</title>
		<script type="text/javascript" src="js/adapter.js"></script>
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="js/Tool.js"></script>
		<script type="text/javascript" src="js/layer/layer.js"></script>
		<link rel="stylesheet" href="css/PerCenter.css" />
		<link rel="stylesheet" href="css/Public.css" />
	</head>
	<body>
		<div class="contents">
			<div class="header">
				<div class="photo"><img src="image/loading.png" id="icon"></div>
				<div class="percenter">
					<div class="percenter-name"></div>
					<div class="percenter-id"></div>
				</div>
				<div class="remove-btn" onclick="cancel()">申请解约</div>
			</div>
			<div class="wapper">
				<div class="list">
					<div class="list-name">公会会长</div>
					<div class="list-con" id="huizhangname">个性</div>
				</div>
				<div class="list">
					<div class="list-name">公会抽成</div>
					<div class="list-con" id="choucheng"></div>
				</div>
				<div class="li">
					<div class="list jianjie">
						<div class="list-name">公会抽成</div>
					</div>
					<p id="desc"></p>
				</div>
			</div>
			<div class="MyMoney">
				<div class="money-pic">我的盈利</div>
				<div class="icon"></div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript">
    $(function(){
        $(".MyMoney").click(function(){
            location.href="MyMoney.html"
        })
    })

	tokeninit(function () {
        $.ajax({
            headers: {
                "XX-Token": localStorage.getItem("XX-Token"),
                "XX-Device-Type": localStorage.getItem("XX-Device-Type")
            },
            url: localStorage.getItem("domain") + 'app/guild/getGuildInfoByuser',
            type: "post",
            data: {},
            dataType: 'json',
            cache: false,
            async: true,
            success: function (res) {
                if (res.code == 1) {
					$('.percenter-name').html(res.data.name);
					$('.percenter-id').html('ID:' + res.data.id);
					$('#huizhangname').html(res.data.user_nickname);
					$('#choucheng').html(res.data.divide_into + '%');
					$('#desc').html(res.data.desc);
					$('#icon').attr('src',res.data.icon);
                } else {
                    layer.msg(res.msg);
                }
            },
            error: function () {
                layer.msg('网络异常');
            }
        });
    })

	function cancel(){
        $.ajax({
            headers: {
                "XX-Token": localStorage.getItem("XX-Token"),
                "XX-Device-Type": localStorage.getItem("XX-Device-Type")
            },
            url: localStorage.getItem("domain") + 'app/guild/applycancel',
            type: "post",
            data: {},
            dataType: 'json',
            cache: false,
            async: true,
            success: function (res) {
                if (res.code == 1) {
                    layer.msg('解约申请成功,等待审核')
                } else {
                    layer.msg(res.msg);
                }
            },
            error: function () {
                layer.msg('网络异常');
            }
        });
	}
</script>
